﻿<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>贪吃蛇</title>
  <link rel="stylesheet" href="css/index.css">
</head>

<body>
  <button id="btn1">开始</button>
  <button id="btn2">停止</button>
  <input type="text" id="input" readonly>
  <!-- 地图 -->
  <div id="map"></div>
  <!--死亡提示 -->
  <div class="dead">
    <h1>Game Over</h1>
    <span id="btn3">重新开始</span>
  </div>
  <!-- jQuery -->
  <script src="./lib/jquery-1.12.4.js"></script>
  <script src="js/food.js"></script>
  <script src="js/game.js"></script>
  <script src="js/snake.js"></script>
  <!-- 开始 -->
  <script>
    // const food = new Food()
    // food.randomLocation()
    // const snake = new Snake()
    // snake.showSnake()
    const game = new Game()
    game.food.randomLocation()
    game.snake.showSnake()
    $('#btn1').click(() => {
      game.start()
    })
    $('#btn2').click(() => {
      game.stop()
    })
    $('#btn3').click(() => {
      game.reStart()
    })
  </script>
</body>

</html>